﻿using System;
using System.Globalization;
using System.Windows;
using System.Windows.Data;

namespace Opds_Viewer.Converter
{
    [ValueConversion(typeof(int), typeof(string))]
    class NbBooksConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter,
                              CultureInfo culture)
        {
            var nb = (int) value;

            if (nb > 0)
            {
                return "(" + nb + " books)";
            }
            return "nb books unknown";
        }

        public object ConvertBack(object value, Type targetType, object parameter,
                                  CultureInfo culture)
        {
            throw new NotImplementedException();
        }
    }
}
